蟻本 2-6 線分上の格子点の個数
code: python
x1, y1 = map(int,input().split())
x2, y2 = map(int,input().split())
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
ans = gcd(abs(x1 - x2), abs(y1 - y2)) - 1
print(ans)
# 1 11
# 5 3
テーマ
#gcd